"""djangoTest2 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)
from rest_framework import routers
from oAuth.views import UserInfoViewSet, UserViewSet, InformationViewSet, DeleteInformationViewSet, TaskViewSet, TaskViewSet2, ShortageViewSet
from oAuth.views import MachineViewSet, RecoverInformationViewSet
from echartsApp.views import MachinePieViewSet, ShortagePieViewSet, TimePieViewSet
from echartsApp.views import MachineDetailViewSet, ShortageDetailViewSet, EveryShortageDetailViewSet, EveryMachineDetailViewSet, MachineTimeViewSet
from echartsApp.views import InformationPieViewSet, ShortageTimeViewSet
from echartsApp.views import Month_MachineViewSet, Month_ShortageViewSet
from oAuth.views import Evaluate_first, Evaluate_second
from oAuth.up_load import upload_excel


router_V1 = routers.DefaultRouter()
router_V1.register('info', UserInfoViewSet)
router_V1.register('users', UserViewSet)
router_V1.register('informations', InformationViewSet)
router_V1.register('recover_informations', RecoverInformationViewSet)

router_V1.register('deleteinformations', DeleteInformationViewSet)
router_V1.register('tasks', TaskViewSet)
router_V1.register('tasks2', TaskViewSet2)
router_V1.register('shortages', ShortageViewSet)
router_V1.register('machines', MachineViewSet)

router_V1.register('echarts/machines/pie', MachinePieViewSet)
router_V1.register('echarts/times/pie', TimePieViewSet)

router_V1.register('echarts/machines/detail', MachineDetailViewSet)
router_V1.register('echarts/shortages/detail', ShortageDetailViewSet)
router_V1.register('echarts/machines/time', MachineTimeViewSet)
router_V1.register('echarts/shortage/time', ShortageTimeViewSet)

router_V1.register('echarts/everyshortages/detail', EveryShortageDetailViewSet)
router_V1.register('echarts/everymachines/detail', EveryMachineDetailViewSet)

router_V1.register('echarts/shortage/pie', InformationPieViewSet)

router_V1.register('echarts/machine/month', Month_MachineViewSet)
router_V1.register('echarts/shortage/month', Month_ShortageViewSet)


urlpatterns = [
    path('api/', include(router_V1.urls)),
    path('admin/', admin.site.urls),
    path('api/login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('api/machine/evaluatefirst/', Evaluate_first),
    path('api/machine/evaluatesecond/', Evaluate_second),
    path('api/upload_excel/', upload_excel, name='upload_excel'),
]
